<template>
    <div>
        <h1>Axios-Post</h1>
        <div class="MyBtn">
            <el-button type="primary" size="mini" @click="postData">获取数据</el-button>
        </div>
        <el-table size="mini" border style="width: 100% " height="550" :data="dataList">
            <el-table-column prop="account" label="账号" align="center"></el-table-column>
            <el-table-column prop="passWord" label="密码" align="center"></el-table-column>
            <el-table-column prop="age" label="年龄" align="center"></el-table-column>
            <el-table-column prop="sex" label="性别" align="center"></el-table-column>
        </el-table>

    </div>
</template>

<script>
import axios from 'axios'
    export default {
        name: "Demo3",
        data(){
            return{
                dataList: []
            }
        },
        methods:{
            postData(){
                axios.post('/api/getData')
                    .then(result => {
                       this.dataList = result.data;
                    });
            }
        }
    }
</script>

<style scoped>
    .MyBtn{
        margin-bottom: 10px;
    }
</style>